home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Information / WebSites / Wirenet / files / ResetNews.lha / ResetNews.thor < prev   
Text File  |  1998-10-06  |  2KB  |  67 lines

  1. /*
  2. $VER: ResetNews.thor 1.1 (6.10.98)
  3. © Neil Bothwick
  4. */
  5.  
  6. /* Resets the article counters for the current system */
  7. /* Use it when changing news servers or when the      */
  8. /* server renumbers its articles                      */
  9.  
  10. /*;;; Initialise */
  11. options results
  12. ;;;
  13. /* ;;;Needs THOR and bbsread.library functions */
  14. thorport = address()
  15. if left(thorport,5) ~= 'THOR.' then do
  16.     say 'CleanSystem.thor must be run from within Thor.'
  17.     exit
  18.     end
  19.  
  20. if ~show('p', 'BBSREAD') then do
  21.     address command
  22.     'run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead'
  23.     'WaitForPort BBSREAD'
  24.     end
  25. ;;;
  26. /* ;;;Get current system name and data directory */
  27. address(thorport)
  28. drop TMP.
  29. 'CURRENTSYSTEM stem TMP'
  30. System = TMP.BBSNAME
  31. address 'BBSREAD'
  32. drop TMP. CONFLIST.
  33. 'GETBBSDATA "'system'" stem TMP'
  34. call pragma('D',TMP.BBSPATH'tcp_tmp')
  35. ;;;
  36. /* ;;; Check if n.progress file exists */
  37. if ~exists('n.progress') then do
  38.     if ~exists('/tcp_tmp.bak/n.progress') then call ExitMsg('This system has no newsgroup list to reset\n'TMP.BBSPATH'tcp_tmp/n.progress not found')
  39.     else address command 'copy /tcp_tmp.bak/n.progress "" clone'
  40.     end
  41. ;;;
  42. /* ;;; Reset count for each group to 1 */
  43. if ~open(infile,'n.progress','R') then call ExitMsg('Error reading n.progress')
  44. if ~open(outfile,'n.progress.new','W') then call ExitMsg('Error creating new progress file')
  45. do until eof(infile)
  46.     newsgroup = readln(infile)
  47.     if newsgroup = '' then iterate
  48.     call writeln(outfile,subword(newsgroup,1,1) '1')
  49.     end
  50. address command 'delete >NIL: /TCPTimestamp.ng'
  51. ;;;
  52. /* ;;; Clean up */
  53. call close(infile)
  54. call close(outfile)
  55. if exists('n.progress.old') then call delete('n.progress.old')
  56. call rename('n.progress','n.progress.old')
  57. call rename('n.progress.new','n.progress')
  58. call ExitMsg('After collecting news you may have a number of duplicate messages\nUse Delete Duplicates from the General menu to remove these')
  59. ;;;
  60. /* ;;; Exit with a message */
  61. ExitMsg:
  62.     parse arg ErrTxt
  63.     address(thorport)
  64.     'REQUESTNOTIFY "'ErrTxt'" " OK "'
  65.     exit
  66. ;;;
  67.